package com.hc.lookSys.servlet;

import java.io.IOException;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.hc.lookSys.services.BookInfoServices;
import com.hc.lookSys.services.BookInfoServicesImpl;

public class BookInfoFindAllServlet extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = -4882454965446559611L;

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		this.doPost(req, resp);
	}

	@Override
	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		request.setCharacterEncoding("UTF-8");
		response.setCharacterEncoding("UTf-8");
		response.setContentType("text/html;charset=Utf-8");

		BookInfoServices bookInfoBiz = new BookInfoServicesImpl();
		List<Map<String, Object>> list = bookInfoBiz.findAll();
		request.setAttribute("list", list);// 数据保存在请求对象中
		request.getRequestDispatcher("login.jsp").forward(request, response);// 页面跳转[数据存在request请求中，页面跳转就用]
	}

}
